package red.action;

import com.opensymphony.xwork2.Action;
import red.model.UserModel;
import red.service.UserService;
import red.service.impl.UserServiceImpl;
import red.util.BaseAction;
import red.util.Model;


import java.util.ArrayList;
import java.util.List;

public class UserAction  extends BaseAction {
    private UserService userService=new UserServiceImpl();
    private UserModel userModel;
    private List<UserModel> userModels;
    public UserService getUserService() {
        return userService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public UserModel getUserModel() {
        return userModel;
    }

    public void setUserModel(UserModel userModel) {
        this.userModel = userModel;
    }

    public List<UserModel> getUserModels() {
        return userModels;
    }

    public void setUserModels(List<UserModel> userModels) {
        this.userModels = userModels;
    }
    public String adduser(){
        Model model = getParams();
        userModel = userService.addUser(model);
        return Action.SUCCESS;
    }
    public String getUser(){
        userModels=new ArrayList<>();
        return Action.SUCCESS;
    }

}
